﻿using Fabrication.DataSources;

namespace Fabrication.ValueProviders
{
    internal class UserNameProvider : ValueProviderBase<string>
    {
        private static readonly int charactersMax = Characters.EnglishCharacters.Count - 1;
        private static readonly int lastNamesMax = HumanNames.LastNames.Count - 1;

        protected sealed override string GetValue(object item)
        {
            var initial = char.ToLowerInvariant(Characters.EnglishCharacters[RandomNumberGenerator.GetInteger(0, charactersMax)]);
            var lastName = HumanNames.LastNames[RandomNumberGenerator.GetInteger(0, lastNamesMax)].ToLowerInvariant();
            return initial + lastName;
        }
    }
}